#!/bin/bash

echo Verifying if node.js is installed
which node
rc=$?
echo $rc
if [[ $rc != 0 ]] ; then
	echo Node.js is not installed
	echo Please goto http://nodejs.org/download/ and install it
	exit -1
fi

echo Installing npm
which npm
rc=$?
if [[ $rc != 0 ]] ; then
	curl https://npmjs.org/install.sh | sudo sh
fi
rm -rf npm-install*.sh

echo Installing node inspector
sudo npm install -g node-inspector

echo Installing socket.io
npm install socket.io

echo Install require js
npm install requirejs

echo Install express
npm install express

echo Install cookie
npm install cookie

echo Enable port manually by doing: sudo ipfw add 8081 allow tcp from any to any
sudo ipfw add 8081 allow tcp from any to any

echo Install request
npm install request

